~ chicken-core (chicken-5) /manual/Module (chicken csi)
Trap1[[tags: manual]]2[[toc:]]34== Module (chicken csi)56This module provides procedures to access features specific to7the {{csi}} interactive interpreter.89=== toplevel-command1011<procedure>(toplevel-command SYMBOL PROC [HELPSTRING])</procedure>1213Defines or redefines a toplevel interpreter command which can be invoked by entering14{{,SYMBOL}}. {{PROC}} will be invoked when the command is entered and may15read any required argument via {{read}} (or {{read-line}}). If the optional16argument {{HELPSTRING}} is given, it will be listed by the {{,?}} command.171819=== set-describer!2021<procedure>(set-describer! TAG PROC)</procedure>2223Sets a custom description handler that invokes {{PROC}} when the24{{,d}} command is invoked with a record-type object that has the type25{{TAG}} (a symbol). {{PROC}} is called with two arguments: the object26to be described and an output-port. It should write a possibly useful27textual description of the object to the passed output-port. For28example:2930 #;1> (define-record-type point (make-point x y) point?31 (x point-x)32 (y point-y))33 #;2> (set-describer! 'point34 (lambda (pt o)35 (with-output-to-port o36 (lambda ()37 (print "a point with x=" (point-x pt) " and y=" (point-y pt))))))38 #;3> ,d (make-point 1 2)39 a point with x=1 and y=2404142=== default-evaluator4344<procedure>(default-evaluator EXPR)</procedure>4546Takes {{EXPR}} and processes any of the built-in toplevel commands provided47by {{csi}}. If {{EXPR}} is not a toplevel command, then it is evaluated using48{{eval}}. This procedure is intended to be passed as an argument to {{repl}}49to allow using {{csi}}s toplevel commands and history management in user-defined50read-eval-print loops.515253=== editor-command5455<parameter>editor-command</parameter>5657Holds the name of an editor that should be used when the toplevel58command {{,e}} is used.596061---62Previous: [[Module (chicken continuation)]]6364Next: [[Module (chicken errno)]]